import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from "@/views/Login"

Vue.use(VueRouter)

const routes = [
    // {
    //     // 用户首页
    //     path: '/index',
    //     name: '首页',
    //     component: Login
    // },
    {
        //访问浏览器访问的路径
        path: '/',
        name: '首页',
        //当访问到上述路径时，显示那个组件
        component: Login
    },
    //修改密码
    {
        path: '/home',
        name: 'Home',
        component: () => import('../views/Home'),
        meta: {
            requireAuth: true,            // 添加该字段，表示进入这个路由是需要登
            title: '首页'
        },
        children: [
            {
                path: 'changePass',
                name: 'changePass',
                component: () => import('../views/pages/User/ChangePass'),
                meta: {
                    requireAuth: true,            // 添加该字段，表示进入这个路由是需要登
                    title: '修改密码'
                },
            },
            {
                path: 'userInfo',
                name: 'userInfo',
                component: () => import('../views/pages/User/UserInfo'),
                meta: {
                    requireAuth: true,            // 添加该字段，表示进入这个路由是需要登
                    title: '个人信息'
                },
            },
            {
                path: 'data',
                name: 'data',
                component: () => import('../views/pages/data/data'),
                meta: {
                    requireAuth: true,            // 添加该字段，表示进入这个路由是需要登
                    title: '首页'
                },
            },
            {
                path: 'teahouse',
                name: 'teaHouse',
                component: () => import('../views/pages/TeaHouse/TeaHouse'),
                meta: {
                    requireAuth: true,
                    title: '茶室管理'
                },
            },
            {
                path: 'commodity',
                name: 'commodity',
                component: () => import('../views/pages/Commodity/Commodity'),
                meta: {
                    requireAuth: true,
                    title: '商品管理'
                },
            },
            {
                path: 'fund',
                name: 'fund',
                component: () => import('../views/pages/Fund/Fund'),
                meta: {
                    requireAuth: true,
                    title: '资金管理'
                },
            },
            {
                path: 'branch',
                name: 'branch',
                component: () => import('../views/pages/Branch/Branch'),
                meta: {
                    requireAuth: true,
                    title: '分店管理'
                },
            },
            {
                path: 'repair',
                name: 'repair',
                component: () => import('../views/pages/Repair/Repair'),
                meta: {
                    requireAuth: true,
                    title: '报修管理'
                },
            },
        ]
    },
     //员工管理
    {
        path: '/home',
        name: 'home',
        component: () => import('../views/Home'),
        meta: {
            requireAuth: true,            // 添加该字段，表示进入这个路由是需要登
            title: '员工管理'
        },
        children: [
            {
                path: 'staff',
                name: 'StaffInformation',
                component: () => import('../views/pages/StaffManage/StaffInformation'),
                meta: {
                    requireAuth: true,            // 添加该字段，表示进入这个路由是需要登
                    title: '员工列表'
                },
            },
            {
                path: 'staff-duty',
                name: 'staff-duty',
                component: () => import('../views/pages/StaffManage/StaffDuty'),
                meta: {
                    requireAuth: true,            // 添加该字段，表示进入这个路由是需要登
                    title: '员工排班'
                },
            },
        ]
    },
    //用户部分路由
    {
        path: '/home',
        name: 'staff',
        component: () => import('../views/Home'),
        meta: {
            requireAuth: false,            // 添加该字段，表示进入这个路由是需要登
            title: '工作'
        },
        children: [
            {
                path: 'order',
                name: 'order',
                component: () => import('../views/Volunteer/Order/OrderIndex'),
                meta: {
                    requireAuth: false,            // true 表示进入这个路由是需要登
                    title: '定茶室'
                },
            },
            {
                path: 'un-order',
                name: 'un-order',
                component: () => import('../views/Volunteer/Order/unOrder'),
                meta: {
                    requireAuth: false,            // true 表示进入这个路由是需要登
                    title: '退茶室'
                },
            },
            {
                path: 'duty',
                name: 'duty',
                component: () => import('../views/Volunteer/Duty/Duty'),
                meta: {
                    requireAuth: false,            // true 表示进入这个路由是需要登
                    title: '排班日程'
                },
            },
            {
                path: 'userInfo',
                name: 'userInfo',
                component: () => import('../views/pages/User/UserInfo'),
                meta: {
                    requireAuth: true,            // 添加该字段，表示进入这个路由是需要登
                    title: '个人信息'
                },
            },
        ]
    },
    {
        path: '/login',
        name: '用户登录',
        component: () => import('../views/Login')
    },
    {
        path: '/register',
        name: '注册',
        component: () => import('../views/Volunteer/Register')
    },
    {
        path: '/resetCode',
        name: '发送验证码',
        component: () => import('../views/pages/User/ResetCode')
    },
    {
        path: '/ChangePass',
        name: '重置密码',
        component: () => import('../views/pages/User/ChangePass')
    }


]

const router = new VueRouter({
    routes
})

export default router
